#ifndef _IN_PER_UART_H_
#define _IN_PER_UART_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include "InCommon.h"
#include "InPerUartRead.h"
#include "InPerUartHandle.h"
#include "tuya_ipc_api.h"
#include "tuya_ipc_dp_utils.h"
#include "tuya_ipc_dp_handler.h"
#include "tuya_ipc_system_control_demo.h"

typedef struct
{
    Com_u8 flag;
    Com_u8 cnt;
    Com_u8 again;
}SPerUartReadWaitInfo,*pSPerUartReadWaitInfo;

typedef enum
{
    COMMAND_MANUAL_FEED                     = 0x01,
    COMMAND_SET_FEED_PLAN                   = 0x02,
    COMMAND_CHECK_FEED_PLAN                 = 0x03,
    COMMAND_MCU_GET_TIME                    = 0x04,
    COMMAND_SET_MCU_TIME                    = 0x05,
    COMMAND_FEED_REMIND                     = 0x06,
    COMMAND_FEED_RESULT                     = 0x07,
    COMMAND_CHECK_VERSION                   = 0x08,
    COMMAND_DEVIVE_RESET                    = 0x09,
    COMMAND_START_UPGRADE                   = 0x0a,
    COMMAND_TRANSFER_UPGRADE_PACKAGE        = 0x0b,
    COMMAND_MCU_NOTICE_RESET                = 0x0c,
    COMMAND_RECORD_MODE                     = 0x0d,
    COMMAND_REPORT_POWER                    = 0x0e,
    COMMAND_FEED_STATE                      = 0x0f,
    COMMAND_FAULT                           = 0x10,
    COMMAND_SURPLUS_STATE                   = 0x11,
    COMMAND_LED_ONOFF                       = 0x12,
    COMMAND_TRANSFER_COMMAND                = 0x13,
    COMMAND_HEARTBEAT                       = 0x17,
    COMMAND_BATTERY_MODE_FEED_RESULT        = 0x18,
    COMMAND_SEND_DEV_NET_STATUS             = 0x19,
    COMMAND_CONTROL_PTZ                     = 0x1A,
    COMMAND_SET_ALARM_LED_STATUS            = 0x1c,
    COMMAND_BURN_BLE_MAC                    = 0x1e,
    COMMAND_CONTROL_BLE_SW                  = 0x1d,
    COMMAND_LOCK_KEY_STATUS                 = 0x27,
    COMMAND_POWER_SUPPLY_MODE               = 0x29,
    COMMAND_USER_STATUS                     = 0x2a,
    COMMAND_MCU_NOTICE_FEED                 = 0x2b,
    COMMAND_CHILD_CLOCK                     = 0x2c,
    COMMAND_AUTO_LOCK_ENABLE                = 0x2d,
    COMMAND_CAT_CLOSE_TIME                  = 0x2e,
    COMMAND_XIAO_AN_CUSTOM_FEED_RESULT      = 0x2f,
    COMMAND_MCU_REPORT_INIT_STATUS          = 0x30,
    COMMAND_MCU_MEAL_PLAN_SW                = 0x31,
    COMMAND_ATMOSPHERE_LIGHT                = 0x32,
    COMMAND_FEED_RESULT_NOTICE              = 0x33,
    COMMAND_KEY_FEED_NUM                    = 0x34,
    COMMAND_SLOW_FEED                       = 0x35,
    COMMAND_SLOW_FEED_TIME                  = 0x36,
    COMMAND_PHOTOGRAPH                      = 0x37,
    COMMAND_IMAGE_UPDATE_TIME               = 0x38,
    COMMAND_IMAGE_UPDATE_SW                 = 0x39,
    COMMAND_REPORT_FEED_TYPE                = 0x3a,
    COMMAND_PET_APPEAR                      = 0x3b,
    COMMAND_CANCEL_ERROR                    = 0x3c,
    COMMAND_BUCKET_SETUP                    = 0x3d,
    COMMAND_BATTERY_STATUS                  = 0x3e,
    COMMAND_PTZ_SPEED                       = 0x3f,
    COMMAND_DEVICE_ACTION                   = 0x40,
    COMMAND_RECHARGE_STATE                  = 0x41,
    COMMAND_LED_SW_PLAN                     = 0x42,
    COMMAND_START_AGING_PROGRAM             = 0x43,
    COMMAND_FOOD_DETECT_STATE               = 0x44,
    COMMAND_KEY_DOWN_NOTIFY                 = 0x45,
    COMMAND_SLEEP_WAKE_SOURCE               = 0x46,
    COMMAND_SET_MCU_FUNCTION_SW             = 0x47,
    COMMAND_VACUUMIZE_NO_DISTURBING_PLAN    = 0x48,
    COMMAND_MAX_NUM,
}EPerUartCmdType;

typedef enum
{
    RECORD_MODE_START = 1,
    RECORD_MODE_STOP,
    RECORD_MODE_PLAY,
    RECORD_MODE_REMOVE,
    RECORD_MODE_MAX_NUM,
}EPerUartRecordMode;

Com_void Ext_InPerUart_SetOtaTotalLen(Com_s32 len);
Com_u8 Ext_InPerUart_GetOtaFlag(Com_void);
Com_u8 Ext_InPerUart_CheckSum(Com_pu8 recv_buf,Com_u32 len);
Com_void Ext_InPerUart_Init(Com_void);

#ifdef __cplusplus
}
#endif

#endif
